<?php
class MatchModel extends Model{

public function MatchMadol($config){
$sql="select m.id,m.team1 as t1,t1.name as n1,m.score as ms,m.team2 as t2,t2.name as n2
from `match` as m left join `team` as t1  on m.team1=t1.id
 left join `team` as t2 on m.team2=t2.id";
$res=$this->mysql->dql($sql);
return $res;
}

public function delete(){
	$sql="delete from `match` where `id`={$_GET['id']}";
	return $this->mysql->dml($sql);
}

public function allTeam($config){
	$sql='select * from team';
	$allTeam=$this->mysql->dql($sql);
	return $allTeam;
}

public function doinsert($post){
	$sql="insert into `match` (`team1`,`score`,`team2`) values ('{$post['team1']}','{$post['score']}','{$post['team2']}')";
	return $this->mysql->dml($sql);
}

}
?>